﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Back/BackgroundMain.master"
    CodeFile="MsgMgr.aspx.cs" Inherits="MessageBoard_MsgMgr" Title="留言板管理" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script type="text/javascript">
    function dispdiv(divid)
    {
         var div = document.getElementById(divid);
  
         if(div.style.display =="inline")
         {
             div.style.display="none";
         }
         else
         {
            div.style.display="inline";
         }
     }  

       // var selNum = 0;           
        function AddSelValues(oChk)  
        { 
            var iphdn = document.getElementById("ctl00_ContentPlaceHolder1_ipt_HdnSelectedValues");             
            if(oChk.checked)
            {
            //    selNum++;
                iphdn.value += "," + oChk.value; 
            }
            else
            {
              iphdn.value = iphdn.value.replace("," + oChk.value,""); 
            }
        }
        
        function countInstances(mainStr, subStr)
        {
            var count = 0;
            var offset = 0;
            do
            {
                offset = mainStr.indexOf(subStr, offset);
                if(offset != -1)
                {
                    count++;
                    offset += subStr.length;
                }
            }while(offset != -1)
            return count;
        }


    </script>

    <asp:ScriptManager runat="server" ID="Script1">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate> 
    <input id="ipt_HdnSelectedValues" type="hidden" name="HdnSelectedValues" runat="server" />
    <div class="centertop" id="dvNav" runat="server">
        当前位置：<a href="BgArticleList.aspx">中共重庆市沙坪坝区委统一战线工作部</a>&nbsp;>>&nbsp;<a href="MsgMgr.aspx">留言板管理</a></div>
    <div style="text-align: left; padding-left: 22px;">
        <div>
            共<asp:Label ID="lbl_Count" Text="0" runat="server" ForeColor="Red"></asp:Label>条留言
        </div>
        <div>
            <asp:GridView ID="gv_MsgList" runat="server" AllowSorting="True" AllowPaging="True"
                AutoGenerateColumns="False" EmptyDataText="没有留言信息" DataKeyNames="ID" PageSize="15"
                OnPageIndexChanging="gv_MsgList_PageIndexChanging" OnSorting="gv_MsgList_Sorting"
                CellPadding="4" ForeColor="#333333" GridLines="None" OnRowDataBound="gv_MsgList_RowDataBound">
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <RowStyle BackColor="#EFF3FB" />
                <Columns>
                 <%--   <asp:BoundField DataField="ID" HeaderText="留言ID" ReadOnly="True" Visible="true" />--%>
                    <asp:TemplateField ItemStyle-Width="30px" HeaderText="编号">
                        <ItemTemplate>
                            <%#Container.DataItemIndex + 1%>
                        </ItemTemplate>
                        <ItemStyle Width="30px"></ItemStyle>
                    </asp:TemplateField>
                    <asp:BoundField ItemStyle-Width="80px" DataField="UserName" HeaderText="用户名称" ReadOnly="True">
                        <ItemStyle Width="80px"></ItemStyle>
                    </asp:BoundField>
                    <asp:TemplateField>
                        <HeaderStyle Width="280px" />
                        <ItemStyle Width="280px"/>
                        <HeaderTemplate>
                            留言内容
                        </HeaderTemplate>
                        <ItemTemplate>
                            <div onclick="dispdiv('<%#Container.DataItemIndex + 1%>')">
                                <%#spbtzb.Common.CutString(spbtzb.AuthenCtr.Decode(Eval("Content").ToString()), 18)%></div>
                            <div id="<%#Container.DataItemIndex + 1%>" style="display: none; word-break:break-all; background-color:Silver;">
                                <%#spbtzb.AuthenCtr.Decode(Eval("Content").ToString())%>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField ItemStyle-Width="80px" DataField="IP" HeaderText="IP" ReadOnly="True">
                        <ItemStyle Width="80px"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField ItemStyle-Width="120px" DataField="CreateTime" HeaderText="留言时间"
                        ReadOnly="True" SortExpression="CreateTime">
                        <ItemStyle Width="120px"></ItemStyle>
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="审核tem" Visible="false">
                        <ItemTemplate>
                            <asp:CheckBox ID="cb_AuditingTemp" runat="server" Enabled="false" Checked='<%#Eval("Status")%>'
                                Width="22px" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="是否通过" SortExpression="Status">
                        <HeaderStyle Width="60px" />
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate>
                            <input type="checkbox" runat="server" id="cb_Auditing" onclick="AddSelValues(this)"
                                value='<%#DataBinder.Eval(Container.DataItem,"ID")%>' />
                        </ItemTemplate>
                        <ItemStyle Width="50px"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField ItemStyle-Width="50px">
                        <HeaderTemplate>
                            删除
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Button ID="btn_Del" runat="server" CommandArgument="DelCmda" CausesValidation="false"
                                Text="删除" OnClientClick="javascript: return confirm('您真的要删除这篇留言吗?');" OnClick="btn_Del_Click" />
                        </ItemTemplate>
                        <ItemStyle Width="50px"></ItemStyle>
                    </asp:TemplateField>
                </Columns>
                <PagerSettings FirstPageText="首页" LastPageText="末页" NextPageText="下页" PreviousPageText="上页" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#2461BF" />
                <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
        </div>
        <div style="text-align: right; padding-right: 20px">
            <asp:Button ID="btn_Auditing" runat="server" CssClass="button" Text="提交" OnClick="btn_Auditing_Click" />
        </div>
    </div>
           </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
